#ifndef STX_CONFIG_HPP
#define STX_CONFIG_HPP

#ifndef NDEBUG
#   define STX_DEBUG 1
#else
#   define STX_DEBUG 0
#endif

//#define STX_CPP11
//#define STX_HAS_RVALUE_REFERENCES
//#define STX_HAS_NULLPTR_T
//#define STX_HAS_CONSTEXPR
//#define STX_HAS_INCLASS_MEMBER_INITIALIZATION
#define STX_HAS_WCHAR_T
//#define STX_HAS_UNICODE_CHARS

#ifdef STX_CPP11
#define STX_NOEXCEPT noexcept
#else
#define STX_NOEXCEPT throw()
#endif

//#define STX_HAS_SYSLOG

//  _WIN32      Defined for both 32-bit and 64-bit environments.
//  _WIN64      Defined for 64-bit environments.
//  __WIN32__   Defined by Borland C++.
//  __TOS_WIN__ Defined by xlC.
//  __WINDOWS__ Defined by Watcom C/C++.
#if defined (_WIN32) || defined (_WIN64) || defined (__WIN32__) || defined (__TOS_WIN__) || defined (__WINDOWS__)
#   define STX_PLATFORM_WINDOWS
#endif

//todo: Maybe should use operator= for version comparison instead of operator>=.
#if defined(unix) || defined(__unix__) || defined(__unix)
#   define STX_PLATFORM_UNIX
#endif
#if defined(STX_PLATFORM_UNIX)
#   include <unistd.h>
#   if defined(_POSIX_VERSION)
#       define STX_PLATFORM_POSIX
#       if (_POSIX_VERSION >= 198808L)
#           define STX_STANDARD_POSIX_1_1988
#       endif
#       if (_POSIX_VERSION >= 199009L)
#           define STX_STANDARD_POSIX_1_1990
#       endif
#       if (_POSIX_VERSION >= 199209L)
#           define STX_STANDARD_POSIX_2_1993
#       endif
#       if (_POSIX_VERSION >= 199309L)
#           define STX_STANDARD_POSIX_1B_1993
#       endif
#       if (_POSIX_VERSION >= 199506L)
#           define STX_STANDARD_POSIX_1_1996
#       endif
#       if (_POSIX_VERSION >= 200112L)
#           define STX_STANDARD_POSIX_1_2001
#           define STX_HAS_SYSLOG
#       endif
#       if (_POSIX_VERSION >= 200809L)
#           define STX_STANDARD_POSIX_1_2008
#       endif
#   endif
#   if defined(_XOPEN_VERSION)
#       if (_XOPEN_VERSION >= 3)
#           define STX_STANDARD_XOPEN_1989
#       endif
#       if (_XOPEN_VERSION >= 4)
#           define STX_STANDARD_XOPEN_1992
#       endif
#       if (_XOPEN_VERSION >= 4) && defined(_XOPEN_UNIX)
#           define STX_STANDARD_XOPEN_1995
#       endif
#       if (_XOPEN_VERSION >= 500)
#           define STX_STANDARD_XOPEN_1998
#       endif
#       if (_XOPEN_VERSION >= 600)
#           define STX_STANDARD_XOPEN_2003
#       endif
#       if (_XOPEN_VERSION >= 700)
#           define STX_STANDARD_XOPEN_2008
#       endif
#   endif
#endif

#ifdef __QNXNTO__
#define STX_PLATFORM_QNX_NEUTRINO 1
#endif

#ifdef STX_PLATFORM_QNX_NEUTRINO
#define STX_BROKEN_CSETJMP 1
#endif

#ifdef _WIN32
#define STX_HAS_PTHREAD_ATTR_GETGUARDSIZE 0
#define STX_HAS_PTHREAD_ATTR_SETGUARDSIZE 0
#define STX_HAS_PTHREAD_CONDATTR_GETCLOCK 0
#define STX_HAS_PTHREAD_CONDATTR_SETCLOCK 0
#define STX_HAS_PTHREAD_MUTEX_GETPRIOCEILING 0
#define STX_HAS_PTHREAD_MUTEX_SETPRIOCEILING 0
#define STX_HAS_PTHREAD_ATTR_GETSTACK 0
#define STX_HAS_PTHREAD_ATTR_SETSTACK 0
#define STX_HAS_PTHREAD_MUTEXATTR_GETPRIOCEILING 0
#define STX_HAS_PTHREAD_MUTEXATTR_SETPRIOCEILING 0
#define STX_HAS_PTHREAD_MUTEXATTR_GETPROTOCOL 0
#define STX_HAS_PTHREAD_MUTEXATTR_SETPROTOCOL 0
#define STX_HAS_PTHREAD_GETCPUCLOCKID 0
#define STX_HAS_PTHREAD_SETSCHEDPRIO 0
#define STX_HAS_PTHREAD_ATFORK 0
#define STX_HAS_PTHREAD_SIGMASK 0
#else
#define STX_HAS_PTHREAD_ATTR_GETGUARDSIZE 1
#define STX_HAS_PTHREAD_ATTR_SETGUARDSIZE 1
#define STX_HAS_PTHREAD_CONDATTR_GETCLOCK 1
#define STX_HAS_PTHREAD_CONDATTR_SETCLOCK 1
#define STX_HAS_PTHREAD_MUTEX_GETPRIOCEILING 1
#define STX_HAS_PTHREAD_MUTEX_SETPRIOCEILING 1
#define STX_HAS_PTHREAD_ATTR_GETSTACK 1
#define STX_HAS_PTHREAD_ATTR_SETSTACK 1
#define STX_HAS_PTHREAD_MUTEXATTR_GETPRIOCEILING 1
#define STX_HAS_PTHREAD_MUTEXATTR_SETPRIOCEILING 1
#define STX_HAS_PTHREAD_MUTEXATTR_GETPROTOCOL 1
#define STX_HAS_PTHREAD_MUTEXATTR_SETPROTOCOL 1
#define STX_HAS_PTHREAD_GETCPUCLOCKID 1
#define STX_HAS_PTHREAD_SETSCHEDPRIO 1
#define STX_HAS_PTHREAD_ATFORK 1
#define STX_HAS_PTHREAD_SIGMASK 1
#endif

#endif // STX_CONFIG_HPP
